package com.pandora.loan.home.web.advice;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

import static com.pandora.loan.home.enums.ExceptionEnum.*;
import static com.pandora.loan.home.web.advice.util.ExceptionEnumConverter.convertToMap;

/**
 * @author developer
 */
@RestController
public class ErrorController {

    @RequestMapping(value = "/error_400", produces = "application/json;charset=UTF-8")
    public Map<String, Object> error400() {
        return convertToMap(BadRequest);
    }

    @RequestMapping(value = "/error_404", produces = "application/json;charset=UTF-8")
    public Map<String, Object> error404() {
        return convertToMap(NotFoundError);
    }

    @RequestMapping(value = "/error_405", produces = "application/json;charset=UTF-8")
    public Map<String, Object> error405() {
        return convertToMap(NotSupportError);
    }

    @RequestMapping(value = "/error_500", produces = "application/json;charset=UTF-8")
    public Map<String, Object> error500() {
        return convertToMap(InternalServerError);
    }
}
